home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / pas_all.zip / TI435.ASC < prev    next >
Text File  |  1991-09-11  |  5KB  |  199 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  TURBO PASCAL FOR THE MACINTOSH         NUMBER  :  435
  9.   VERSION  :  1.00a/1.1
  10.        OS  :  SYSTEM 4.2/FINDER 6.0 OR LATER
  11.      DATE  :  MAY 5, 1988                              PAGE  :  1/3
  12.  
  13.     TITLE  :  HIERARCHICAL MENUS
  14.  
  15.  
  16.  
  17.  
  18.   Hierarchical menus are a new feature implemented in System/Finder
  19.   4.2/6.0  or  higher.  This feature allows you to create pull down
  20.   windows  that  have  a selection which opens  another  pull  down
  21.   window to the right (or left) side of the current pull down. This
  22.   selection is noted by a small  triangle  on the right side of the
  23.   choice.
  24.  
  25.   1)   To  create  a  hierarchical  menu  option,  add  a new  MENU
  26.        resource to your resource file with an ID between 0 and 253.
  27.        Insert  the  resource  into  the  MenuList   (you   can  use
  28.        MenuList[x] := GetMenu(y)).
  29.  
  30.   2)   Since the  selection to open a hierarchical menu cannot have
  31.        a check mark or Command Key to access it, you  utilize these
  32.        fields to denote a hierarchical menu.
  33.  
  34.   3)   You need to set the Command Key field of the  menu selection
  35.        that connects the pull  down  with  the hierarchical menu to
  36.        $1B.  This  can  be done with the  SetItemCmd  procedure  as
  37.        follows:
  38.  
  39.   SetItemCmd ( MenuList [ MenuNumber ], ItemNumber, Chr ($1B) );
  40.  
  41.        or if you are using version 1.00a of Turbo Pascal,  you must
  42.        modify the menu selection in the resource file  to  end with
  43.        /\1B as follows:
  44.  
  45.   Hierarchical Menu/\1B
  46.  
  47.        MenuNumber  is  the  number  of  the pull down  window  that
  48.        activates the hier. menu.  ItemNumber  is  the number of the
  49.        selection in the above mentioned pull down to open the hier.
  50.        menu.
  51.  
  52.   4)   Set  the  Item  Mark  field   to  the  resource  ID  of  the
  53.        hierarchical menu. Use the SetItemMark command as follows:
  54.  
  55.   SetItemMark ( MenuList [MenuNum], ItemNum, Chr (ResourceID) );
  56.  
  57.        Where MenuNum is  the  same as MenuNumber above, and ItemNum
  58.        is the same as ItemNumber above.
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.   PRODUCT  :  TURBO PASCAL FOR THE MACINTOSH         NUMBER  :  435
  75.   VERSION  :  1.00a/1.1
  76.        OS  :  SYSTEM 4.2/FINDER 6.0 OR LATER
  77.      DATE  :  MAY 5, 1988                              PAGE  :  2/3
  78.  
  79.     TITLE  :  HIERARCHICAL MENUS
  80.  
  81.  
  82.  
  83.  
  84.   5)   Insert the menu with  a  -1 to indicate it is a Hierarchical
  85.        menu.  Use the InsertMenu procedure to do this as follows:
  86.  
  87.   InsertMenu ( MenuList [HierMenuNum], -1 );
  88.  
  89.        When you highlight  the  pull down window selection with the
  90.        black triangle, the Hierarchical Menu you defined will open.
  91.  
  92.        Steps to modify the MyDemo program  to  include Hierarchical
  93.        Menus:
  94.  
  95.    1)  Open the MyDemo.R file
  96.  
  97.    2)  Find the MENU resource, ID 1004
  98.  
  99.    3)  a.   Append new lines after Check Mark as follows:
  100.  
  101.             Hierarchical
  102.  
  103.                  ,100
  104.             Hierarchical Menu
  105.             Choice One
  106.             Choice Two
  107.  
  108.        b.   In accordance with the note  above,  if  you  are using
  109.             Turbo Pascal version 1.00a, change  the  first  line of
  110.             the above changes to read as follows:
  111.  
  112.             Hierarchical/\1B
  113.  
  114.    4)  Save and use RMaker to compile
  115.  
  116.    5)  Open MyDemo.Pas
  117.  
  118.    6)  Modify constant MenuCnt to equal 6, not 5
  119.  
  120.    7)  Add new constants:
  121.  
  122.             HierMenu = 100; { Resource ID of Hierarchical Menu }
  123.             HM       = 6;   { Index into MenuList for Apple Menu }
  124.  
  125.  
  126.    8)  Go down to procedure Initialize
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.   PRODUCT  :  TURBO PASCAL FOR THE MACINTOSH         NUMBER  :  435
  141.   VERSION  :  1.00a/1.1
  142.        OS  :  SYSTEM 4.2/FINDER 6.0 OR LATER
  143.      DATE  :  MAY 5, 1988                              PAGE  :  3/3
  144.  
  145.     TITLE  :  HIERARCHICAL MENUS
  146.  
  147.  
  148.  
  149.  
  150.    9)  a.   After the line
  151.  
  152.                  MenuList[DM] := GetMenu (DiskMenu);
  153.  
  154.             Add:
  155.  
  156.             MenuList[HM] := GetMenu (HierMenu);
  157.             SetItemCmd ( MenuList [DM], 7, Chr ($1B) );
  158.             SetItemMark ( MenuList [DM], 7, Chr ( HierMenu ) );
  159.  
  160.        b.   In accordance with the note  above,  if  you  are using
  161.             Turbo  Pascal version 1.00a, do not add the second line
  162.             (SetItemCmd...).
  163.  
  164.   10)  Change the statement:
  165.             for Indx := 1 to MenuCnt do
  166.        To:
  167.             for Indx := 1 to (MenuCnt - 1) do
  168.  
  169.   11)  On the line before 'DrawMenuBar;' insert the following line:
  170.  
  171.             InsertMenu (MenuList[HM], -1);
  172.  
  173.   12)  Save the modified file and recompile the program
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.